<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
    <meta name="format-detection"content="telephone=no, email=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" /><!-- 删除苹果默认的工具栏和菜单栏 -->
    <meta name="apple-mobile-web-app-status-bar-style" content="black" /><!-- 设置苹果工具栏颜色 -->
    <meta name="renderer" content="ie-comp">
    <meta name="renderer" content="ie-stand">
    <meta name="renderer" content="webkit"> 
    <meta name="keywords" content="财子科技"/>
    <meta name="description" content="财子科技知识产权共享平台。专注于为大众富裕阶层、精英个人、中产阶级家庭、合规机构等提供定制化资产配置咨询推荐服务，帮助客户实现财富的增值。" />
    <title>首页</title>
    <script src="../lib/js/ftSize.js"></script>
    <script>
        let wpuserToken=window.sessionStorage.getItem('wpuserToken');
        function goMine(){
            if(wpuserToken=='' ||wpuserToken==null){
                window.location.href="../login/login.html"
            }else{
                window.location.href="../mine/index.html"
                
            }
        }
    </script>
    <link rel="stylesheet" href="../lib/css/_base.css">
    <link rel="stylesheet" href="../lib/css/swiper.min.css">
    <link rel="stylesheet" href="../lib/css/home.css">
<style>
    header, footer, main {
    display: block;
}
.swiper-container{
    width:6.8rem;
    height:3.6rem;
}
.swiper-wrapper{
    width:6.8rem;
    height:2.83rem;
}
.swiper-slide{
    width:6.8rem;
    height:2.83rem;
    overflow: hidden;
}
.swiper-slide>img{
    width:100%;
    height:auto;
}
.swiper-pagination-bullet-active{
    background:#AE915F!important;
}
.swiper-pagination{
    bottom:.3rem;
    position: absolute;
    left:50%;
}

</style>
</head>

<body >
<div class="layout-fixed">
    <header id="header">
        <div class="head-body">
                <a href="index.html" class="head-logo"><img src="../lib/images/head-logo.png" alt=""></a>
                <span class="goLogin" id="homeLogin">
                    <a href="../login/login.html">登录</a>/
                    <a href="../login/register.html">注册</a>
                </span>
                <a href="../mine/index.html" id="homeMine"><span class="homeMine"></span></a>
                
        </div>   
    </header>
    <div class="swiper-container">
            <div class="swiper-wrapper" id="swiper-wrapper">
                <!-- <a class="swiper-slide" href="https://www.baidu.com/"><img src="../lib/images/banner.png"></a>
                <a class="swiper-slide" href="https://www.baidu.com/"><img src="../lib/images/222.png"></a>
                <a class="swiper-slide" href="https://www.baidu.com/"><img src="../lib/images/banner.png"></a> -->
            </div>
            <div class="swiper-pagination"></div>
        </div>
        <!-- 可以滚动的区域 -->
    <main class="home-main">
        
        <section class="home-setions" id="home-credit-business">
                <div class="home-title">
                    <h3>网贷</h3>
                    <a href="../productList/index.html" class="title-subtitle">优选推荐 收益无忧</a>
                   <!--  <span class="title-subtitle">优选推荐 收益无忧</span> -->
                </div>
                <ul id="creditList">
                   <!--  <li>
                        <div class="credit-home-title"> 
                            个人消费贷款
                          
                        </div>
                        <div class="credit-home-left">
                            <span class="credit-home-rate block">
                                <em class="credit-home-baseBase"> 9.3%</em>
                                <em class="credit-home-afterBase">+3.0%</em>
                            </span>
                            <span class="credit-home-borrow block">
                                借款利率
                            </span>
                        </div>
                        <div class="credit-home-right">
                            <span class="creadit-home-limit block">
                                    项目期限 30天
                            </span>
                            <span class="credit-home-means block">
                                    到期还本息
                            </span>
                        </div>
                    </li>
                    <li>
                        <div class="credit-home-title"> 
                                个人消费贷款
                        </div>
                        <div class="credit-home-left">
                            <span class="credit-home-rate block">
                                <em class="credit-home-baseBase"> 9.3%</em>
                                <em class="credit-home-afterBase">+3.0%</em>
                            </span>
                            <span class="credit-home-borrow block">
                                借款利率
                            </span>
                        </div>
                        <div class="credit-home-right">
                            <span class="creadit-home-limit block">
                                    项目期限 30天
                            </span>
                            <span class="credit-home-means block">
                                    到期还本息
                            </span>
                        </div>
                    </li>  -->
                </ul>
        </section>
        <!-- 保险 -->
        <section class="home-setions" id="home-insurance-business">
            <div class="home-title">
                <h3>保险</h3>
                <a href="../productList/insuranceList.html" class="title-subtitle">投资幸福 安心保障</a>
            </div>
            <div id="home-insurance-recom"></div>
            <!-- <dl>
                <dt>
                    <img src="../lib/images/Bitmap.png" alt="">
                </dt>
                <dd>
                    <p class="home-insurance-title">
                        尊享e生旗舰版
                    </p>
                    <p class="home-insurance-subtitle">
                        【保额600万 免费医疗垫付】 癌症无免赔，全癌症无免癌症无免
                    </p>
                    <p class="home-insurance-price">
                        <em> 146</em>元/起
                    </p>
                </dd>
            </dl>
            <dl>
                <dt>
                    <img src="../lib/images/Bitmap.png" alt="">
                </dt>
                <dd>  
                    <p class="home-insurance-title">
                        尊享e生旗舰版
                    </p>
                    <p class="home-insurance-subtitle">
                        【保额600万 免费医疗垫付】 癌症无免赔，全癌症无免癌症无免
                    </p>
                    <p class="home-insurance-price">
                        <em> 146</em>元/起
                    </p>
                </dd>
            </dl> -->
        </section>      
    </main>
        <!-- fixed定位的底部 -->
    <footer id="footer">
        <div class="footerActive" id="foot-body"> <a href="../home/index.html" class="iconActive" > <i id="startPage"></i><small>首页</small></a><a href="../productList/index.html"><i id="centerPage"></i><small>产品列表</small></a><a href="javascript:;" onClick="goMine()"><i id="endPage"></i><small>我的</small></a></div>
    </footer>
</div> 
<script src="../lib/js/jquery.min.js"></script>  
<script src="../lib/js/public-header.js"></script> 
<script src="../lib/js/swiper.min.js"></script>
<script>
let userInfo=JSON.parse(window.sessionStorage.getItem('wpuserInfo') ); 
    
if(userInfo!=null){
   $('#homeMine').show()
   $('#homeLogin').hide()
}else{
    $('#homeLogin').show()
    $('#homeMine').hide()
}
/* 保险详情 */
    function goInsur(ids){
        window.location.href='../productList/InsuranceDetails/index.html?projectId='+ids;
    }
/* banner传递的数据 */
function bannerJson() {
    var json = {
         "token":" ",
         "clientInfo":"W,100,IE8",
         "requestTime": formatDateTime(startTime),
         "faceCode":"banner/show",
     }
    return json;
}
/* 网贷传递的数据 */
function grabLoanJson() {
    var json = {
         "token":" ",
         "clientInfo":"W,100,IE8",
         "requestTime": formatDateTime(startTime),
         "faceCode":"project/grabLoan",
         "body":{"type":"2"},
     }
    return json;
}
/* 保险传递的数据 */
function insuranceJson() {
    var json = {
        "faceCode":"insurance/getRecommendList",
        "token":"",    
        "clientInfo":"W,100,IE8",  
        "requestTime": formatDateTime(startTime),
        "body":{}
     }
    return json;
}
/* 轮播 */
    var mySwiper = new Swiper('.swiper-container', {
        autoplay: true,//可选选项，自动滑动
        pagination: '.swiper-pagination',//可选选项，是否显示分页器
        paginationClickable: true,//可选选项，是否点击分页器滑动
        pagination: {
            el: '.swiper-pagination',
        },
        observer:true,//修改swiper自己或子元素时，自动初始化swiper
        observeParents:true,//修改swiper的父元素时，自动初始化swiper
        loop : true,//环路
    })
    /* banner */
    $.ajax({
        type: "POST",
        url: httpServer+"banner/show",//图片轮播
        headers:{
            'Access-Control-Allow-Origin':'*'
        }, 
        contentType: "application/json; charset=utf-8",
        data: JSON.stringify(bannerJson()),
        dataType: "json",
        success: function (bannerShow) {
            if(bannerShow.resCode!='0'){
                oneError(bannerShow)
            }else{
                bannerShow =bannerShow.body
                var bannerList='';
                if(bannerShow!=[]){
                    $.each(bannerShow,function(ids,ele){
                        bannerList+=`<a class="swiper-slide" href="${ele.jump_address}"><img src="${ele.visit_address}" alt="${ele.image_name}" /></a>`
                        /* bannerList+='<a href="'+ele.jump_address+'"><div class="swiper-slide"><img src="'+ele.visit_address+'" alt="'+ele.image_name+'"></div> </a>'  */
                    })
                    $('#swiper-wrapper').html(bannerList)
                }   
            }
        },
        error: function (message) {
        }     
    });
/* 网贷 */
$.ajax({  
    type: "POST",
    url: httpServer+"project/grabLoan",
    headers:{
        'Access-Control-Allow-Origin':'*'
    }, 
    contentType: "application/json; charset=utf-8",
    data: JSON.stringify(grabLoanJson()),
    dataType: "json",
    success: function (creditShow) {  
        if(creditShow.resCode!='0'){
                oneError(creditShow)
        }else{
            var creditList=''
            if(creditShow.body!=[]){
                creditShow=creditShow.body.slice(2)
                $.each(creditShow,function(ids,ele){
                let baserateEm=''
                    if(ele.afterRate=='0.00'){
                        baserateEm=''
                    }else{
                        baserateEm=`<em class="credit-home-afterBase">+`+ele.afterRate+`%</em>`;
                    }
                    creditList+=`<a href="`+ele.jumpUrl+`"><li>
                            <div class="credit-home-title"> `+ele.projectName+`</div>
                            <div class="credit-home-left">
                                <span class="credit-home-rate block">
                                    <em class="credit-home-baseBase">`+ele.baseRate+`%</em>`+baserateEm+`
                                </span>
                                <span class="credit-home-borrow block">
                                    借款利率
                                </span>
                            </div>
                            <div class="credit-home-right">
                                <span class="creadit-home-limit block">
                                        项目期限 `+ele.formatInvestTime+ele.investTimeUnit+`
                                </span>
                                <span class="credit-home-means block">
                                        `+ele.refundTypeNote+`
                                </span>
                            </div>
                        </li></a>`;
                })
                $('#creditList').html(creditList)
            } 
        }      
   },
   error: function(error){  
     console.log(error,2);  
    }    
}); 
/* 保险 */
$.ajax({  
    type: "POST",
    url: httpServer+"insurance/getRecommendList",//首页保险推荐
    headers:{
        'Access-Control-Allow-Origin':'*'
    }, 
    contentType: "application/json; charset=utf-8",
    data: JSON.stringify(insuranceJson()),
    dataType: "json", 
   success: function (insuranceShow) {  
        if(insuranceShow.resCode!='0'){
            oneError(insuranceShow)
        }else{
        var insuranceList=''
        insuranceShow=insuranceShow.body;
        if(insuranceShow!=[]){
            insuranceShow=insuranceShow.recommendList.slice(2);
            $.each(insuranceShow,function(ids,ele){
                var premium_type;
                if(ele.premium_type=='1'){
                    premium_type='元'
                }else if(ele.premium_type=='2'){
                    premium_type='元/起'
                }
                insuranceList+=`<dl onClick="goInsur(`+ele.id+`)">
                    <dt><img src="`+ele.image_url+`" alt=""></dt>
                    <dd>
                        <p class="home-insurance-title">`+ele.project_name+`</p>
                        <p class="home-insurance-subtitle">`+ele.project_info+`</p>
                        <p class="home-insurance-price"><em> `+ele.insured_amount+`</em>`+premium_type+`</p>
                    </dd>
                </dl>`
            })
            $('#home-insurance-recom').html(insuranceList)
        }
        }
        
   },
   error: function(error){  
     console.log(error,3);  
    }    
}); 












</script>   
</body>
</html>